from os.path import dirname, join as pjoin
from scipy.io import wavfile
import scipy.io
import matplotlib.pyplot as plt
import numpy as np
# data_dir = pjoin(dirname(scipy.io.__file__), 't2')
data_dir='.'
wav_fname = pjoin(data_dir, '30025.wav')
samplerate, data = wavfile.read(wav_fname)
# print(f"number of channels = {data.shape[1]}")
length = data.shape[0] / samplerate
# print(f"length = {length}s")
time = np.linspace(0., length, data.shape[0])
# plt.plot(time, data[:,0], label="channel")
# plt.plot(time, data[:, 1], label="Right channel")
plt.plot( data, label="channel")
plt.legend()
plt.xlabel("Time [s]")
plt.ylabel("Amplitude")
plt.show()
